package com.android.measuringimportanceoflectureslides.menu;

import com.android.measuringimportanceoflectureslides.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class Menu extends Activity {

		protected void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			
			setContentView(R.layout.menues);
			
			registerForContextMenu(findViewById(R.id.btn_menues_kontextmenue));
		}

		public void onNavButtonClick(View view) {
			switch (view.getId()) {
			case R.id.btn_menues_icons:
//				startActivity(new Intent(this, MenueIcons.class));
				break;
			}
		}

//		public boolean onCreateOptionsMenu(Menu menu) {
//			getMenuInflater().inflate(R.menu.menues, menu);
//			return super.onCreateOptionsMenu(menu);
//		}

		public boolean onOptionsItemSelected(MenuItem item) {
			switch (item.getItemId()) {
			case R.id.opt_help:
				Toast.makeText(
						this, 
						"Menü 'Hilfe' ausgewählt", 
						Toast.LENGTH_SHORT)
				.show();
				return true;
			case R.id.opt_preferences:
				startActivity(new Intent(this, Preference.class));
				return true;
			case R.id.opt_eye:
				Toast.makeText(
						this, 
						"Menü 'Ansicht' ausgewählt", 
						Toast.LENGTH_SHORT)
						.show();
				return true;
			}
			return super.onOptionsItemSelected(item);
		}

		public boolean onContextItemSelected(MenuItem item) {
			Toast.makeText(this,
					"'" + item.getTitle() + "' ausgewählt",
					Toast.LENGTH_SHORT)
			.show();
			return super.onContextItemSelected(item);
		}

		public void onCreateContextMenu(ContextMenu menu, View v,
				ContextMenuInfo menuInfo) {
			
			switch (v.getId()) {
			case R.id.btn_menues_kontextmenue:
				getMenuInflater().inflate(R.menu.menues_btn_context, menu);
				break;
			}

			super.onCreateContextMenu(menu, v, menuInfo);
		}
}
